/* ******* Green Rotations ******** */

void g1(struct aCube * cube) {
	g1c( cube );
	g1e( cube );
}

void g2(struct aCube * cube) {
	g2c( cube );
	g2e( cube );
}

void g3(struct aCube * cube) {
	g3c( cube );
	g3e( cube );
}

void g1c(struct aCube * cube) {

	short temp = cube[C8].g;
        cube[C8].g = cube[C7].g;
        cube[C7].g = cube[C3].g;
        cube[C3].g = cube[C1].g;
        cube[C1].g = temp;

        temp = cube[C8].y;
        cube[C8].y = cube[C7].r;
        cube[C7].r = cube[C3].w;
        cube[C3].w = cube[C1].o;
        cube[C1].o = temp;

        temp = cube[C8].o;
        cube[C8].o = cube[C7].y;
        cube[C7].y = cube[C3].r;
        cube[C3].r = cube[C1].w;
        cube[C1].w = temp;

	temp = cube[C8].pos;
        cube[C8].pos = cube[C7].pos;
        cube[C7].pos = cube[C3].pos;
        cube[C3].pos = cube[C1].pos;
        cube[C1].pos = temp;
}

void g1e(struct aCube * cube) {

	short temp = cube[E20].g;
        cube[E20].g = cube[E15].g;
        cube[E15].g = cube[E17].g;
        cube[E17].g = cube[E12].g;
        cube[E12].g = temp;

        temp = cube[E20].o;
        cube[E20].o = cube[E15].g;
        cube[E15].g = cube[E17].r;
        cube[E17].r = cube[E12].w;
        cube[E12].w = temp;

	temp = cube[E20].pos;
        cube[E20].pos = cube[E15].pos;
        cube[E15].pos = cube[E17].pos;
        cube[E17].pos = cube[E12].pos;
        cube[E12].pos = temp;
}

void g2c(struct aCube * cube) {

        short temp = cube[C1].g;
        cube[C1].g = cube[C7].g;
	cube[C7].g = temp;
        temp = cube[C3].g;
        cube[C3].g = cube[C8].g;
        cube[C8].g = temp;

        temp = cube[C1].o;
        cube[C1].o = cube[C7].r;
        cube[C7].r = temp;
        temp = cube[C3].w;
        cube[C3].w = cube[C8].y;
        cube[C8].y = temp;

        temp = cube[C1].w;
        cube[C1].w = cube[C7].y;
        cube[C7].y = temp;
        temp = cube[C3].r;
        cube[C3].r = cube[C8].o;
        cube[C8].o = temp;

        temp = cube[C1].pos;
        cube[C1].pos = cube[C7].pos;
        cube[C7].pos = temp;
	temp = cube[C3].pos;
        cube[C3].pos = cube[C8].pos;
        cube[C8].pos = temp;
}

void g2e(struct aCube * cube) {

        short temp = cube[E20].g;
        cube[E20].g = cube[E17].g;
        cube[E17].g = temp;
        temp = cube[E12].g;
        cube[E12].g = cube[E15].g;
        cube[E15].g = temp;

        temp = cube[E20].o;
        cube[E20].o = cube[E17].r;
        cube[E17].r = temp;
        temp = cube[E12].w;
        cube[E12].w = cube[E15].y;
        cube[E15].y = temp;

        temp = cube[E20].pos;
        cube[E20].pos = cube[E17].pos;
        cube[E17].pos = temp;
        temp = cube[E12].pos;
        cube[E12].pos = cube[E15].pos;
        cube[E15].pos = temp;
}

void g3c(struct aCube * cube) {

        short temp = cube[C1].g;
        cube[C1].g = cube[C3].g;
        cube[C3].g = cube[C7].g;
        cube[C7].g = cube[C8].g;
        cube[C8].g = temp;

        temp = cube[C1].o;
        cube[C1].o = cube[C3].w;
        cube[C3].w = cube[C7].r;
        cube[C7].r = cube[C8].y;
        cube[C8].y = temp;

        temp = cube[C1].w;
        cube[C1].w = cube[C3].r;
        cube[C3].r = cube[C7].y;
        cube[C7].y = cube[C8].o;
        cube[C8].o = temp;

        temp = cube[C1].pos;
        cube[C1].pos = cube[C3].pos;
        cube[C3].pos = cube[C7].pos;
        cube[C7].pos = cube[C8].pos;
        cube[C8].pos = temp;
}

void g3e(struct aCube * cube) {

        short temp = cube[E12].g;
        cube[E12].g = cube[E17].g;
        cube[E17].g = cube[E15].g;
        cube[E15].g = cube[E20].g;
        cube[E20].g = temp;

        temp = cube[E12].w;
        cube[E12].w = cube[E17].r;
        cube[E17].r = cube[E15].y;
        cube[E15].y = cube[E20].o;
        cube[E20].o = temp;

        temp = cube[E12].pos;
        cube[E12].pos = cube[E17].pos;
        cube[E17].pos = cube[E15].pos;
        cube[E15].pos = cube[E20].pos;
        cube[E20].pos = temp;
}
